package com.efesco.service.compensation;

import com.bstek.dorado.common.*;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.DBStatement;
import com.bstek.dorado.view.*;
import com.bstek.dorado.view.data.*;
import com.bstek.dorado.view.control.*;
import com.efesco.common.CommUtil;

/**
 * V_auditing_formViewModel
 */
public class V_auditing_formViewModel extends DefaultViewModel {
  public void init(int state)
      throws Exception {
    // Add your code here
    super.init(state);
  }

  protected void initDatasets()
      throws Exception {
    super.initDatasets();
    // Add your code here
  }

  protected void initControls()
      throws Exception {
    super.initControls();
    // Add your code here
  }

  protected void doLoadData()
      throws Exception {
    // Add your code here
    super.doLoadData();
  }

  protected void doUpdateData(ParameterSet parameters)
  throws Exception {
	  Dataset ds=getDataset("dataset_invoice");
	  DBStatement dbs=new DBStatement();
	  ds.moveFirst();
	  while(!ds.isLast()){
		  if(ds.getRecordState() == Record.STATE_MODIFIED){
			 dbs.setSql("delete from s_verify_result where medical_bill_id="+ds.getString("MEDICAL_BILL_ID"));
			 dbs.execute();
			 dbs.setSql("insert into s_verify_result(MEDICAL_BILL_ID,AMOUNT,VERIFY_DATE,DISEASE_REASON,REMARK,VERIFY_STAFF_ID,VERIFY_TYPE)values(" +
					 ds.getString("MEDICAL_BILL_ID")+",'"+ds.getString("AMOUNT1")+"',sysdate,'"+ds.getString("DISEASE_REASON")
					 +"','"+ds.getString("REMARK")+ "','"+CommUtil.getOperatetId()+"','"+parameters.getValue("type")+"')");
			 dbs.execute();
		  }
		  ds.moveNext();
	  }
   // super.doUpdateData(parameters);
  }

}
